package com.hanrui.android.fragment.message.audit.seal;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.hanrui.android.R;
import com.hanrui.android.library.base.BaseFragment;
import com.hanrui.android.model.SealBorrowDetailBean;
import com.hanrui.android.net.contract.message.audit.seal.SealBorrowDetailContract;
import com.hanrui.android.net.presenter.message.audit.seal.SealBorrowDetailPresenter;

import butterknife.BindView;

/**
 * 借章审批基本信息
 *
 */

public class SealBorrowDetailFragment extends BaseFragment<SealBorrowDetailPresenter> implements SealBorrowDetailContract.View {
    @BindView(R.id.main_title)
    TextView mainTitle;
    @BindView(R.id.subhead_title)
    TextView subheadTitle;
    @BindView(R.id.name)
    TextView name;
    @BindView(R.id.thing_title)
    TextView thingTitle;
    @BindView(R.id.time)
    TextView time;
    @BindView(R.id.leaders)
    TextView leaders;
    @BindView(R.id.head_company)
    TextView headCompany;
    @BindView(R.id.duty_company)
    TextView dutyCompany;
    @BindView(R.id.assign_body)
    TextView assignBody;
    @BindView(R.id.duty_people)
    TextView dutyPeople;
    @BindView(R.id.from)
    TextView from;
    @BindView(R.id.base_data)
    TextView baseData;
    @BindView(R.id.work_content)
    TextView workContent;
    @BindView(R.id.reson)
    TextView reson;


    String taskId,procInsId,bizId;

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_sealborrowdetail;
    }

    @Override
    protected void initInjector() { mFragmentComponent.inject(this); }

    @Override
    protected void initView(View view) {

        taskId = getArguments().getString("taskId");
        procInsId = getArguments().getString("procInsId");
        bizId = getArguments().getString("bizId");

        mPresenter.sealBorrowBizDetail(getActivity(),taskId,procInsId,bizId);

    }



    public static SealBorrowDetailFragment newInstance(String taskId, String procInsId, String bizId) {
        SealBorrowDetailFragment fragment = new SealBorrowDetailFragment();
        Bundle bundle = new Bundle();
        bundle.putString("taskId", taskId);
        bundle.putString("procInsId", procInsId);
        bundle.putString("bizId", bizId);
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    public void sealBorrowBizDetail(SealBorrowDetailBean data) {

        if (null != data) {

            mainTitle.setText(data.getDetail().getUserName()+"的借章审批");
            subheadTitle.setText(data.getDetail().getBorrowDate());
            name.setText(data.getDetail().getUserName());
            thingTitle.setText(data.getDetail().getCompanyName());
            time.setText(data.getDetail().getOfficeName());
            assignBody.setText(data.getDetail().getPerson());
            leaders.setText(data.getDetail().getBorrowDate());
            headCompany.setText(data.getDetail().getEstimateDate());
            dutyCompany.setText(data.getDetail().getReturnDate());
            from.setText(data.getDetail().getUser());
            dutyPeople.setText(data.getDetail().getTypeName());
            baseData.setText(data.getDetail().getBasicInfor());
            workContent.setText(data.getDetail().getReason());
            reson.setText(data.getDetail().getRemarks());

        }

    }
}
